import random


def QuickSort(a):
        print a
        if len(a) > 0:
                pivot=a[len(a)-1]
                left, right = (0, len(a)-1)
                
                while left < right:
                        while a[left] < pivot and left < right:
                                left+=1
                        while a[right] >= pivot and left < right:
                                right-=1
                        if left < right:
                                a[left], a[right] = a[right], a[left]
                a[left],a[len(a)-1] = a[len(a)-1], a[left]
                a[:left]=QuickSort(a[:left])
                a[left+1:]=QuickSort(a[left+1:])
        return a


def mkQuick():
        a=[]
        for k in range(16):
                a.append(random.randrange(1,50))
        print QuickSort(a)
